package xpn.platform.modules.workflow.other.comment;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import xpn.platform.common.persistence.AbstractBaseEntity;
import xpn.platform.modules.workflow.other.commentcolumn.CommentColumn;
import xpn.platform.modules.workflow.runtime.instance.Instance;
import xpn.platform.modules.workflow.runtime.todo.Todo;

import lombok.Getter;
import lombok.Setter;

/**
 * 意见
 */
@Entity
@Table(name = "wf_ru_comment")
@Getter
@Setter

public class Comment extends AbstractBaseEntity {

    private static final long serialVersionUID = 4743065331381024352L;

    /**
     * 填写人Id
     */
    @JoinColumn(nullable = false)
    private String userId;

    /**
     * 填写人name
     */
    @JoinColumn(nullable = false)
    private String userName;

    /**
     * 填写人机构名称
     */
    @JoinColumn(nullable = false)
    private String userOrgName;

    /**
     * 意见内容
     */
    @NotNull
    private String content;

    /**
     * 对应意见栏
     */
    @ManyToOne
    @JoinColumn(nullable = false)
    private CommentColumn column;

    /**
     * 对应待办
     */
    @ManyToOne
    @JoinColumn
    private Todo todo;

    /**
     * 对应实例
     */
    @ManyToOne
    @JoinColumn(nullable = false)
    private Instance instance;
}
